Set up the IMU
My connection:
· Connect IMU, Artemis, and PC together, try the IMU example codes:
· AD0_VAL is the last bit of I2C address of IMU, set it to 0 since we haven’t soldered 2 IMU pads and enabled the ADR jumper yet.
· Accelerometer measures the acceleration of IMU board, the gyroscope measures the angular acceleration of the board. In motions such as rotate or flip the IMU, both acceleration and gyroscope readings change; when accelerate it, only the accelerometer;s reading changes; In angular motions, accelerometer’s reading are changed according to current IMU orientation, but gyroscope’s reading only changes when there’s movements, i.e. when IMU is stationary with an angle to the desk, the former’s reading don’t necessarily be 0, but the later’s is around 0.
Accelerometer
Roll&Pitch with angles at {-90, 0, 90} degrees
· When roll is 90 degrees, the reading from accelerometer is 87~88, error is less than 3%, is acceptable, thus the accelerometer can be considered as accurate:
o
· When pitch is -90 degrees, the reading from accelerometer is -87~-89, the error is less than 3%, the accelerometer can be considered as accurate:
o
· The equation used to calculate these are 180 / M_PI * atan2(sensor->accY() and 180 / M_PI * atan2(sensor->accX(), sensor->accZ()), 2, 0), sensor->accZ()), 2, 0), which is essentially the 2 equations mentioned in lecture:
o
· From the graph above, the accuracy of the accelerometer can be shown. It has some error, but within the acceptence range.
Analysis of accelerometer’s noise
· When pounding the table, the Fourier graph looks like:
o
o It is easy to tell there’s high frequency noise.
o Using the formula from lecture,
I implemented a Low pass filter:
o With this low pass filter, the high frequency errors are reduced a lot:
§
· Simulate the noise by tapping the table, then draw the Fourier graph, and we can see there’ s no significant high frequency noise. This might be because of the IMUS’s internal low pass filter.
Gyroscope
· The degree measurement by gyroscope is implemented using the formula from lecture notes:
o
o Substitute the values into the equation, I got the following code:
roll_gy += 0.006935 * sensor->gyrX();
pitch_gy += 0.006935 * sensor->gyrY();
yaw_gy += 0.006935 * sensor->gyrZ();
where the number 0.006935 is the time between each measurement, the dt.
· Graph of roll’s and pitch’s readings
o Roll:
o
o Pitch:
o
· Comparison between the diagram of gyroscope and accelerometer:
o
o The sketch of gyroscope is much smoother than that of accelerometer, but it has a continuous drifting.
· The design of complimentary filter and choice of parameter
o
o I used the equation above. The value of alpha I chose was 0.5, which makes the final curve smoothy without having too much drifting:
§ Roll
§
§ Pitch
§
§
Data collection
· When I was dealing with data collection, I had trouble with sending all data to computer using Bluetooth, but fortunately I got solution in the end: improve the size of the data by using simplest notations for parsing only, and split it, then store the data needed into an array(see the code graph below):
o
· In the picture above, among every 3 numbers splited by ‘|’, the 1st is millitime, 2nd is row, the 3rd is pitch. The sampling time interval is 0.006935, which is got by measuring the average interval.
o
· By adding enough sampling data point in the ble_arduino, I got a 7 seconds IMU data with time stamp:
o